package com.itbaizhan;
/*创建表orders
* CREATE TABLE `orders` (
2  `orderid` int(11) NOT NULL AUTO_INCREMENT,
3  `orderprice` float(11,2) DEFAULT NULL,
4  `user_id` int(11) DEFAULT NULL,
5  PRIMARY KEY (`orderid`),
6  KEY `orders_fk` (`user_id`),
7  CONSTRAINT `orders_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`userid`)
8) ENGINE=InnoDB DEFAULT CHARSET=utf8;*/

/*创建表item
* create Table items(itemid int(11) not null,
itemname varchar(30) default null,
itemprice float(11,2) DEFAULT null,
itemnum int(11) default null,
PRIMARY key(itemid))
engine=innodb default charset = utf8;*/

/*创建中间表
* CREATE TABLE `orders_items` (
2  `order_id` int(11) NOT NULL,
3  `item_id` int(11) NOT NULL,
4  PRIMARY KEY (`order_id`,`item_id`),
5  KEY `orders_items_fk2` (`item_id`),
6  CONSTRAINT `orders_items_fk` FOREIGN KEY (`order_id`) REFERENCES `orders` (`orderid`),
7  CONSTRAINT `orders_items_fk2` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemid`)
8) ENGINE=InnoDB DEFAULT CHARSET=utf8;*/
public class Test001 {
}
